<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
    <meta charset="utf-8">
    <meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport"/>
    <title></title>
    <meta content="" name="keywords"/>
    <meta content="" name="description"/>
    <link href="/web/css/normalize.css" rel="stylesheet" type="text/css"/>
    <link href="/web/css/style.css" rel="stylesheet" type="text/css"/>
    <link href="/web/css/animate.css" rel="stylesheet" type="text/css"/>
    <link href="/web/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
    <link href="/web/layui/css/layui.css" rel="stylesheet" type="text/css"/>
    <style>
        [v-cloak] {
            display: none;
        }
    </style>
</head>
<body>
<div id="app" v-cloak>
    <div class="contain">
        <div class="sidebar" id="head">

        </div>
        <section>
            <div class="right_h" id="right_h">

            </div>
            <div class="qulicklink">
                <ul>
                    <li><a href="javascript:;"></a></li>
                    <li><a href="javascript:;"><span>企业首页</span><img src="/web/images/close.png"></a></li>
                    <li class="dq"><a href="javascript:;"><span>业务管理</span><img src="/web/images/close.png"></a></li>
                    <li><a href="javascript:;"></a></li>
                </ul>
            </div>
            <div class="breadcrumbs">
                <ul>
                    <li>业务管理</li>
                    <li>咨询线索</li>
                </ul>
            </div>
            <div class="clearfix"></div>
            <div class="content">
                <div class="addbtn" v-if="sum(18)">
                    <a @click="addbtnClick()" href="javascript:;">新增</a>
                </div>
                <div class="deletebtn" v-if="sum(20)">
                    <a @click="deletesClick()" href="javascript:;">删除</a>
                </div>
                <div class="importbtn" v-if="sum(21)">
                    <a @click="importClick()" href="javascript:;">导入</a>
                </div>
                <div class="adSearchbtn" v-if="sum(1101)">
                    <a @click="adSearchbtnClick()" href="javascript:;">高级搜索</a>
                </div>
                <!--高级搜索下拉框开始-->
                <div class="searchBox">
                    <div class="searchKey">
                        <label>
                            <span>客户名称:</span> <input autocomplete="off" id="searchtitle" name="resetval" placeholder="请输入客户名称"
                                                      type="text"/>
                        </label>
                        <label>
                            <span>客户类型:</span>
                            <div class="layui-input-block">
                                <select autocomplete="off" id="searchtype" lay-filter="batch"
                                        lay-search="required" lay-verify="required" name="resetval">
                                    <option class="promptColor" value="0">请选择客户类型</option>
                                    <option :value="v.id" v-for="(v,k) in ajaxData.type">{{v.title}}</option>
                                </select>
                            </div>
                        </label>
                        <label>
                            <span>创建时间:</span>
                            <div class="layui-input-inline">
                                <div class="starttitme"><input autocomplete="off" class="layui-input"
                                                               id="start_time" name="resetval" placeholder="yyyy-MM-dd"
                                                               type="text"/></div>
                                <div class="endtitme"><input autocomplete="off" class="layui-input" id="end_time"
                                                             name="resetval" placeholder="yyyy-MM-dd" type="text"/></div>
                            </div>
                        </label>
                        <label>
                            <span>所属行业:</span>
                            <div class="layui-input-block">
                                <select id="searchindustry" lay-filter="batch" lay-search="required"
                                        lay-verify="required" name="resetval">
                                    <option class="promptColor" value="0">请选择所属行业</option>
                                    <option :value="v.id" v-for="(v,k) in ajaxData.industry">{{v.title}}</option>
                                </select>
                            </div>
                        </label>
                        <label>
                            <span>所属地区:</span>
                            <div class="layui-input-block">
                                <select id="searchprovince" lay-filter="batch" lay-search="required"
                                        lay-verify="required" name="resetval">
                                    <option class="promptColor" value="0">请选择所属地区</option>
                                    <option :value="v.id" v-for="(v,k) in ajaxData.province">{{v.name}}</option>
                                </select>
                            </div>
                        </label>
                        <label>
                            <span>客户级别:</span>
                            <div class="layui-input-block">
                                <select autocomplete="off" class="category" id="category"
                                        lay-filter="batch" lay-search="required" lay-verify="required" name="resetval">
                                    <option class="promptColor" value="0">请选择客户级别</option>
                                    <option :value="v.id" v-for="(v,k) in ajaxData.category">{{v.title}}</option>
                                </select>
                            </div>
                        </label>
                        <label>
                            <span>电话号码:</span> <input class="username" id="searchtel" name="resetval"
                                                      placeholder="请输入客户电话号码" type="text"/>
                        </label>
                        <label>
                            <span>客户来源:</span>
                            <div class="layui-input-block">
                                <select id="searchfrom" lay-filter="batch" lay-search="required"
                                        lay-verify="required" name="resetval">
                                    <option class="promptColor" value="0">请选择客户来源</option>
                                    <option :value="v.id" v-for="(v,k) in ajaxData.from">{{v.title}}</option>
                                </select>
                            </div>
                        </label>
                        <label>
                            <span>业务员:</span>
                            <div class="layui-input-block">
                                <select id="searchuser" lay-filter="batch" lay-search="required"
                                        lay-verify="required" name="resetval">
                                    <option class="promptColor" value="0">请选择业务员</option>
                                    <option :value="v.id" v-for="(v,k) in ajaxData.user">{{v.realname}}</option>
                                </select>
                            </div>
                        </label>
                    </div>
                    <div class="btns">
                        <div class="addbtn searchbtn">
                            <a @click="searchbtnClick()" href="javascript:;">搜索</a>
                        </div>
                        <div class="addbtn setbtn">
                            <a @click="resetbtnClick()" href="javascript:;">重置</a>
                        </div>
                    </div>
                </div>
                <!--高级搜索下拉框结束-->
                <!-- 这里是新增编辑弹出框开始-->
                <div class="consulting hidden">
                    <div class="addtitle">基本信息</div>
                    <div class="layerbody">
                        <label>
                            <span>客户名称:</span> <input autocomplete="off" class="username" id="title" name="resetTc"
                                                      placeholder="请输入客户名称" type="text"/>
                        </label>
                        <label>
                            <span>网址:</span> <input autocomplete="off" class="link" id="link" name="resetTc"
                                                    placeholder="请输入客户网址" type="text"/>
                        </label>
                        <label>
                            <span>联系人:</span> <input autocomplete="off" class="contacts" id="contacts" name="resetTc"
                                                     placeholder="请输入联系人" type="text"/>
                        </label>
                        <label>
                            <span>电话号码:</span> <input autocomplete="off" class="tel" id="tel" maxlength="11"
                                                      name="resetTc" placeholder="请输入电话号码" type="text"/>
                        </label>
                        <div class="address1">
                            <label>
                                <span>省份:</span>
                                <div class="layui-input-block">
                                    <select @change="provincechange($event)" autocomplete="off" id="province"
                                            lay-filter="batch" lay-search="required" lay-verify="required"
                                            name="resetTc" v-model="provinceid">
                                        <option class="promptColor" value="0">请选择所在省份</option>
                                        <option :value="v.id" v-for="(v,k) in ajaxData.province">{{v.name}}</option>
                                    </select>
                                </div>
                            </label>
                            <label>
                                <span>城市:</span>
                                <div class="layui-input-block">
                                    <select autocomplete="off" id="citys" lay-filter="batch"
                                            lay-search="required" lay-verify="required" name="resetTc" v-model="cityid">
                                        <option class="promptColor" id="default" value="0">请选择所在市区</option>
                                        <option :value="v.id" v-for="(v,k) in citys">{{v.name}}</option>
                                    </select>
                                </div>
                            </label>
                        </div>
                        <div class="address">
                            <label>
                                <span>地址:</span>
                                <textarea autocomplete="off" class="contents" id="address" name="resetTc" placeholder="详细地址"
                                          resize="" rows="2"></textarea>
                            </label>
                        </div>
                        <label>
                            <span>客户类型:</span>
                            <div class="layui-input-block">
                                <select autocomplete="off" class="type" id="type"
                                        lay-filter="batch" lay-search="required" lay-verify="required" name="resetTc"
                                        v-model="typeid">
                                    <option class="promptColor" value="0">请选择客户类型</option>
                                    <option :value="v.id" v-for="(v,k) in ajaxData.type">{{v.title}}</option>
                                </select>
                            </div>
                        </label>
                        <label>
                            <span>客户级别:</span>
                            <div class="layui-input-block">
                                <select autocomplete="off" class="category" id="category"
                                        lay-filter="batch" lay-search="required" lay-verify="required" name="resetTc"
                                        v-model="categoryid">
                                    <option class="promptColor" value="0">请选择客户级别</option>
                                    <option :value="v.id" v-for="(v,k) in ajaxData.category">{{v.title}}</option>
                                </select>
                            </div>
                        </label>
                        <label>
                            <span>来源:</span>
                            <div class="layui-input-block">
                                <select autocomplete="off" class="from" id="from"
                                        lay-filter="batch" lay-search="required" lay-verify="required" name="resetTc"
                                        v-model="fromid">
                                    <option class="promptColor" value="0">请选择客户来源</option>
                                    <option :value="v.id" v-for="(v,k) in ajaxData.from">{{v.title}}</option>
                                </select>
                            </div>
                        </label>
                        <label>
                            <span>行业:</span>
                            <div class="layui-input-block">
                                <select autocomplete="off" class="industry" id="industry"
                                        lay-filter="batch" lay-search="required" lay-verify="required" name="resetTc"
                                        v-model="industryid">
                                    <option class="promptColor" value="0">请选择行业</option>
                                    <option :value="v.id" v-for="(v,k) in ajaxData.industry">{{v.title}}</option>
                                </select>
                            </div>
                        </label>
                        <label>
                            <span>咨询日期:</span>
                            <div class="layui-input-inline">
                                <input autocomplete="off" class="layui-input" id="date5" name="resetTc"
                                       placeholder="yyyy-MM-dd" type="text">
                            </div>
                        </label>
                        <div class="address">
                            <label>
                                <span>描述:</span>
                                <textarea autocomplete="off" class="contents" id="content" name="resetTc" placeholder="您的留言"
                                          resize="" rows="4"></textarea>
                            </label>
                        </div>
                        <label v-if="sum(69)">
                            <span>分配人:</span>
                            <div class="layui-input-block">
                                <select autocomplete="off" class="industry" id="user"
                                        lay-filter="batch" lay-search="required" lay-verify="required" name="resetTc"
                                        v-model="userid">
                                    <option class="promptColor" value="0">请选择分配人</option>
                                    <option :value="v.id" v-for="(v,k) in ajaxData.user">{{v.realname}}</option>
                                </select>
                            </div>
                        </label>
                    </div>
                    <button @click="addsureBtn()" class="surebtn" type="submit">确认</button>
                    <button @click="addresetBtn()" class="resetbtn" type="submit">重置</button>
                </div>
                <!-- 这里是新增编辑弹出框结束-->

                <div class="search">
                    <!--模糊查询开始-->
                    <label>
                        <span>客户名称:</span>
                        <div class="searchbox">
                            <input @input="search($event)" placeholder="请输入您要搜索客户名称" type="text">
                        </div>
                    </label>
                    <!--模糊查询结束-->

                </div>
            </div>
            <div class="t_body">
                <div class="table-responsive">
                    <table class="table">
                        <thead>
                        <tr>
                            <th><input @click="deleteCheckAll()" class="checkboxAll" id="deleteCheckAll"
                                       type="checkbox"> 全选
                            </th>
                            <th>客户名称</th>
                            <th>电话</th>
                            <th>客户类型</th>
                            <th>客户级别</th>
                            <th>客户来源</th>
                            <th>省份</th>
                            <!--<th>城市</th>-->
                            <th>所属行业</th>
                            <th>员工</th>
                            <!--<th>最后跟进</th>-->
                            <!--<th>创建时间</th>-->
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr @dblclick="editorClick(v.id)" v-for="(v,k) in tableDataList">
                            <td><input :id="'listcheck' + (v.id)" class="selectCheck" type="checkbox"></td>
                            <td>{{v.title}}</td>
                            <td>{{v.tel}}</td>
                            <td>{{v.typetitle}}</td>
                            <td>{{v.categorytitle}}</td>
                            <td>{{v.fromtitle}}</td>
                            <td>{{v.provincename}}</td>
<!--                            <td>{{v.cityname}}</td>-->
                            <td>{{v.industrytitle}}</td>
                            <td>{{v.username}}</td>
<!--                            <td>{{v.updatetime}}</td>-->
<!--                            <td>{{v.createtime}}</td>-->
                            <td>
                                <div class="editor" v-if="sum(19)">
                                    <a @click="editorClick(v.id)" href="javascript:;">
                                        <img src="images/editor.png">
                                    </a>
                                    <span>编辑</span>
                                </div>
                                <div class="deletes" v-if="sum(20)">
                                    <a @click="deletesClick(v.id)" href="javascript:;">
                                        <img src="images/deletes.png">
                                    </a>
                                    <span>删除</span>
                                </div>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>

                <!---------------------------分页start----------------------------->
                <div class="pageFen" v-if="totalNum>1">
                    <ul>
                        <li>
                            <a @click="setPage(curNum-1)" class="pageLink" href="#">上一页</a>
                        </li>
                        <li v-for="n in totalNum">
                            <a class="pageLink curNum" v-if="n == curNum" v-text="n"></a>
                            <a @click="setPage(n)" class="pageLink" href="javascript:;" v-else v-text="n"></a>
                        </li>
                        <li><a @click="setPage(curNum+1)" class="pageLink" href="#">下一页</a></li>
                    </ul>
                </div>
                <!---------------------------分页end-------------------------------->
            </div>
        </section>
    </div>
</div>
<script src="/web/js/vue.js"></script>
<script src="/web/js/jquery-1.10.0.min.js"></script>
<script src="/web/layui/layui.js"></script>
<script src="/web/js/transform.js"></script>
<script>
    layui.use('laydate', function () {
        var laydate = layui.laydate;
        //录入时间
        layui.use(['laydate'], function () {
            var $ = layui.$;
            var laydate = layui.laydate;
            var nowTime = new Date().valueOf();
            var max = null;

            var start = laydate.render({
                elem: '#start_time',
                type: 'date',
                format: 'yyyy-MM-dd',
                max: nowTime,
                btns: ['clear', 'confirm'],
                done: function (value, date) {
                    endMax = end.config.max;
                    end.config.min = date; //最大时间为结束时间的开始值
                    end.config.min.month = date.month - 1;
                }
            });

            var end = laydate.render({
                elem: '#end_time',
                type: 'date',
                max: 4073558400000,
                format: 'yyyy-MM-dd',
                min: nowTime,
                done: function (value, date) {
                    if ($.trim(value) == '') {
                        var curDate = new Date();
                        date = {
                            'date': curDate.getDate(),
                            'month': curDate.getMonth() + 1,
                            'year': curDate.getFullYear()
                        };
                    }
                    start.config.max = date;//最小时间为开始时间的最大值
                    start.config.max.month = date.month - 1;
                }
            })
            var start1 = laydate.render({
                elem: '#start_time1',
                type: 'date',
                format: 'yyyy-MM-dd',
                max: nowTime,
                btns: ['clear', 'confirm'],
                done: function (value1, date1) {
                    endMax = end1.config.max;
                    end1.config.min = date1; //最大时间为结束时间的开始值
                    end1.config.min.month = date1.month - 1;
                }
            });

            var end1 = laydate.render({
                elem: '#end_time1',
                type: 'date',
                max: 4073558400000,
                format: 'yyyy-MM-dd',
                min: nowTime,
                done: function (value1, date1) {
                    if ($.trim(value1) == '') {
                        var curDate = new Date();
                        date1 = {
                            'date': curDate.getDate(),
                            'month': curDate.getMonth() + 1,
                            'year': curDate.getFullYear()
                        };
                    }
                    start1.config.max = date1;//最小时间为开始时间的最大值
                    start1.config.max.month = date1.month - 1;
                }
            })
        });

        laydate.render({
            elem: '#date5', //指定元素
            type: "date", // 组件的类型：year,month,time···
            format: 'yyyy-MM-dd'// 设置显示格式
        });
    });
</script>
<script>
    AppData = new Vue({
        el: '#app',
        data: {
            tableData: {},
            tableDataList: {},
            categoryIndex: -1,
            cindex: -1,
            userList: {},
            totalNum: 0, //总页数
            listRows: 8, //每页数量
            curNum: 1, //当前页码
            departmentList: {},
            dataList: {},
            ajaxData: {},
            citys: {},
            provinceid: 0,
            cityid: 0,
            typeid: 0,
            categoryid: 0,
            fromid: 0,
            industryid: 0,
            userid: 0,
            addoredit: 0,
            map: {},
            characterid: 2
        },
        mounted() {
            $("#head").load("header.html");
            $("#right_h").load("right.html");
            this.getIndexData();
        },
        methods: {
            verification(data) {
                if (data.status == 2) {
                    layer.msg(data.message, {icon: 2, time: 1000}, function () {
                        window.location.href = "login.html";
                    });
                }
            },
            search(e) {
                var that = this;
                var keywords = e.target.value;
                this.map.title = keywords;
                this.getIndexData();
            },
            setPage(num) {
                //页码小于等于1
                if (num < 1) {
                    num = 1;
                }
                //页码大于总页数
                if (num > this.totalNum) {
                    num = this.totalNum;
                }
                //页码赋给当前页
                this.curNum = num;
                this.getIndexData();
            },
            searchbtnClick() {
                //获取所有搜索关键值
                var map = {
                    title: $('#searchtitle').val(),
                    typeid: $('#searchtype').val(),
                    start_time: $('#start_time').val(),
                    industryid: $('#searchindustry').val(),
                    provinceid: $('#searchprovince').val(),
                    categoryid: $('#category').val(),
                    tel: $('#searchtel').val(),
                    fromid: $('#searchfrom').val(),
                    userid: $('#searchuser').val()
                };
                this.map = map;
                this.getIndexData();
                console.log(this.map);
            },
            sum(sumid) {//验证列表里的修改删除是否要显示(根据对应的id)
                for (i in this.dataList) {
                    if (sumid == this.dataList[i].id) {
                        return true;
                    }
                }
                return false;
            },
            addbtnClick() {
                this.addresetBtn();
                this.addoredit = 0;
                layeraddoredit = layer.open({
                    type: 1,
                    title: '基本设置',
                    maxmin: true,
                    resize: true,
                    shadeClose: false, //点击遮罩关闭层
                    area: ['900px', '750px'],
                    content: $('.consulting'),
                    success: function () {
                        $.ajax({
                            type: "GET",
                            dataType: "json",
                            url: '/clue/create',
                            data: {},
                            success: function (data) {
                                AppData.verification(data);
                                AppData.ajaxData = data;
                            },
                            error: function (msg) {
                                console.log(msg);
                            }
                        });
                    },
                    end: function () { //解决弹窗关闭以后,弹窗内容还出现在下方的问题
                        $('.consulting').hide();
                    }
                })
            },
            editorClick(edid) {
                this.addoredit = edid;
                layeraddoredit = layer.open({
                    type: 1,
                    title: '基本设置',
                    maxmin: true,
                    resize: true,
                    shadeClose: false, //点击遮罩关闭层
                    area: ['900px', '750px'],
                    content: $('.consulting'),
                    success: function () {
                        $.ajax({
                            type: "GET",
                            dataType: "json",
                            url: '/clue/' + edid,
                            data: {},
                            success: function (data) {
                                AppData.verification(data);
                                AppData.ajaxData = data;
                                AppData.citys = data.city;
                                AppData.provinceid = data.info.provinceid;
                                AppData.cityid = data.info.cityid;
                                AppData.typeid = data.info.typeid;
                                AppData.categoryid = data.info.categoryid;
                                AppData.fromid = data.info.fromid;
                                AppData.industryid = data.info.industryid;
                                AppData.userid = data.info.userid;
                                //输入框赋值
                                $('#title').val(data.info.title);
                                $('#link').val(data.info.link);
                                $('#contacts').val(data.info.contacts);
                                $('#tel').val(data.info.tel);
                                $('#address').val(data.info.address);
                                $('#date5').val(data.info.firsttime);
                                $('#content').val(data.info.content);
                            },
                            error: function (msg) {
                                console.log(msg);
                            }
                        });
                    },
                    end: function () { //解决弹窗关闭以后,弹窗内容还出现在下方的问题
                        $('.consulting').hide();
                    }
                })
            },
            addsureBtn() {
                var title = $('#title').val();
                var link = $('#link').val();
                var contacts = $('#contacts').val();
                var address = $('#address').val();
                var firsttime = $('#date5').val();
                var content = $('#content').val();
                var tel = $('#tel').val();
                var province = $('#province').val();
                var citys = $('#citys').val();
                var type = $('#type').val();
                var from = $('#from').val();
                var industry = $('#industry').val();
                var user = $('#user').val();
                var data = {
                    title: title,
                    tel: tel,
                    typeid: type,
                    categoryid: this.categoryid,
                    fromid: from,
                    provinceid: province,
                    cityid: citys,
                    industryid: industry,
                    userid: user,
                    link: link,
                    contacts: contacts,
                    address: address,
                    firsttime: firsttime,
                    content: content,
                };
                if (this.addoredit == 0) {
                    //新增
                    $.ajax({
                        type: "POST",
                        dataType: "json",
                        url: '/clue',
                        data: data,
                        success: function (data) {
                            AppData.verification(data);
                            if (data.status == 1) {
                                layer.msg(data.message, {icon: 1, time: 1000}, function () {
                                    AppData.getIndexData();
                                    layer.close(layeraddoredit);
                                });
                            } else {
                                layer.msg(data.message, {icon: 2, time: 1000});
                            }
                        },
                        error: function (msg) {
                            console.log(msg);
                        }
                    });
                } else {
                    //编辑
                    $.ajax({
                        type: "PUT",
                        dataType: "json",
                        url: '/clue/' + this.addoredit,
                        data: data,
                        success: function (data) {
                            AppData.verification(data);
                            if (data.status == 1) {
                                layer.msg(data.message, {icon: 1, time: 1000}, function () {
                                    AppData.getIndexData();
                                    layer.close(layeraddoredit);
                                });
                            } else {
                                layer.msg(data.message, {icon: 2, time: 1000});
                            }
                        },
                        error: function (msg) {
                            console.log(msg);
                        }
                    });
                }
            },
            adSearchbtnClick() {
                $('.searchBox').slideToggle();
                $('.search').toggle();
            },
            resetbtnClick() {
                this.map = {};
                $('input[name="resetval"]').val('');
                $('select[name="resetval"]').val('');
                this.getIndexData();
            },
            provincechange(e) {
                id = event.target.value;
                $.ajax({
                    type: "GET",
                    dataType: "json",
                    url: '/clue/' + id + '/edit',
                    data: {},
                    success: function (data) {
                        AppData.verification(data);
                        AppData.citys = data.citys;
                    },
                    error: function (msg) {
                        console.log(msg);
                    }
                });
            },
            deleteCheckAll() {
                let checkBoxs = AppData.tableDataList;
                if ($('#deleteCheckAll').is(":checked")) {
                    for (let j in checkBoxs) {
                        $('#listcheck' + checkBoxs[j].id).prop('checked', true);
                    }
                } else {
                    for (let j in checkBoxs) {
                        $('#listcheck' + checkBoxs[j].id).prop('checked', false);
                    }
                }
            },
            deletesClick(deleteid) {
                layui.use('layer', function () {
                    layer.confirm('确认要删除吗？', {
                        btn: ['确定', '取消']//按钮
                    }, function () {
                        let ids = [];
                        if (deleteid) {
                            //单个删除
                            ids.push(deleteid);
                        } else {
                            //全部删除
                            let checkBoxs = AppData.tableDataList;
                            for (let i in checkBoxs) {
                                if ($('#listcheck' + checkBoxs[i].id).is(":checked")) {
                                    ids.push(checkBoxs[i].id);
                                }
                            }
                        }
                        if (ids.length == 0) {
                            layer.msg('请选择你要删除的选项');
                            return false;
                        }
                        $.ajax({
                            type: "DELETE",
                            dataType: "json",
                            url: '/clue/0',
                            data: {'ids': ids},
                            success: function (data) {
                                AppData.verification(data);
                                if (data.status == 1) {
                                    layer.msg(data.message, {icon: 1, time: 1000}, function () {
                                        AppData.getIndexData();
                                    });
                                } else {
                                    layer.msg(data.message, {icon: 2, time: 1000});
                                }
                            },
                            error: function (msg) {
                                console.log(msg);
                            }
                        });
                    });
                });
            },
            addresetBtn() {
                $('input[name="resetTc"]').val('');
                $('select[name="resetTc"]').val('0');
                $('textarea[name="resetTc"]').val('');
                this.provinceid = 0;
                this.cityid = 0;
                this.typeid = 0;
                this.categoryid = 0;
                this.fromid = 0;
                this.industryid = 0;
                this.userid = 0;
            },
            // 首页获取列表
            getIndexData() {
                $.ajax({
                    type: "GET",
                    dataType: "json",
                    url: '/clue',
                    data: {listRows: this.listRows, page: this.curNum, map: this.map},
                    success: function (data) {
                        AppData.verification(data);
                        AppData.dataList = data.userInfo.jurisdiction;
                        AppData.totalNum = data.list.last_page;
                        AppData.ajaxData = data;
                        let dataS = data.userInfo.jurisdiction;//后台初始数据
                        var dataArr = [];
                        for (let i in dataS) {
                            dataArr.push(dataS[i]); //属性
                        }
                        /*调用封装的改变数据结构方法*/
                        let tableData = setTreeData(dataArr);
                        let tableDataObj = {...tableData};//把转换后的数组通过扩展运算符改成对象便于遍历
                        AppData.tableData = tableDataObj;
                        //表格中数据的渲染
                        let tableList = {...data.list.data};
                        AppData.tableDataList = tableList;
                    },
                    error: function (msg) {
                        console.log(msg);
                    }
                });
            }
        }
    })
</script>
</body>
</html>
